package com.nifostasky.comic.controller;

import com.nifostasky.comic.exceptions.BusinessException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 配置抛出的异常信息
 */
@RestController
@RequestMapping("/exception")
public class ExceptionController {

    /**
     * 过滤器filter : 抛出自定义异常
     */
    @RequestMapping("/throwBusinessException")
    public void throwMyException(HttpServletRequest request){
        BusinessException filterException = (BusinessException)request.getAttribute("filterException");
        throw filterException;
    }
}
